import request from '@/utils/request'

/**
 * 获取-部门
 * @returns {*}
 */
export function getDepartment() {
  return request({
    url: '/company/department',
    method: 'get'
  })
}

/**
 * 新增-部门
 * @param data
 */
export function addDepartment(data) {
  return request({
    url: '/company/department',
    method: 'post',
    data
  })
}

/**
 * 获取全部部门负责人
 */
export function getAllManager() {
  return request({
    url: '/sys/user/simple',
    method: 'get'
  })
}

/**
 * 获取部门详情
 * @param id 部门id
 */
export function getDepartmentDetails(id) {
  return request({
    url: `/company/department/${id}`,
    method: 'get'
  })
}

/**
 * 修改部门详情
 * @param id 部门id
 * @param data 部门信息
 */
export function updateDepartmentDetails(id, data) {
  return request({
    url: `/company/department/${id}`,
    method: 'put',
    data
  })
}

/**
 * 删除部门详情
 * @param id 部门id
 */
export function deleteDepartmentDetails(id) {
  return request({
    url: `/company/department/${id}`,
    method: 'delete'
  })
}
